package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 活动类型枚举
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum ArticleContentTypeEnum {
    /**
     * 动态
     */
    DYNAMIC(0, "STORY"),
    /**
     * 长文
     */
    LONG_ESSAY(1, "POST"),

    /**
     * 短视频
     */
    SHORT_VIDEO(2, "SHORT_VIDEO"),

    ;

    private final Integer code;
    private final String name;

    public static ArticleContentTypeEnum getNameByCode(Integer code) {

        return Arrays.stream(ArticleContentTypeEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getCode().equals(code))
                .findFirst().orElse(null);

    }

}
